package h_innerclass;

/**
 * @author Cheng-02
 * @version V1.0
 * @Package h_innerclass
 * @date 2024/3/31 下午4:19
 */
public class Test01 {
    public static void main(String[] args) {
        new USB() {
            public void open() {
                System.out.println("USB open");
            }

            public void close() {
                System.out.println("USB close");
            }
        }.close();//匿名内部类
        System.out.println("----------------------------------------");
        USB usb = new USB(){
            public void open() {
                System.out.println("USB open");
            }
            public void close() {
                System.out.println("USB close");
            }
        };
        usb.close();
        usb.close();//匿名的有名内部类

    }
}
